package com.axc.gallery2.net;

import android.app.Activity;

import com.axc.gallery2.R;
import com.renren.api.connect.android.Renren;

public class ApiInvoker {
    
    private static Renren renren;
    
    /**
     * Initialize the invoker. This method must be called before calling 'invoke'
     * 
     * @param renren
     */
    public static void init(Renren renren) {
        ApiInvoker.renren = renren;
    }
    
    /**
     * Call the api demo methods specified by its invoke name
     * 
     * @param activity The activity in which the method is called
     * @param invokeName The name used to specify which demo method to be called
     */
    public static void invoke(Activity activity, String invokeName) {
        if(invokeName.equals(activity.getString(R.string.one_click_photo_invoke))) {
            Photo.uploadPhotoWithActivity(activity, renren);
        } else if(invokeName.equals(activity.getString(R.string.publish_photo_invoke))) {
            Photo.uploadPhoto(activity, renren);
        }
    }


}
